﻿using Comm520;
using RFIDSystem.DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RFIDSystem
{
    public class BaseForm : Form
    {
        public static int CurrentUserId { get; set; }
        public static string CurrentUserName { get; set; }
        public static int CruuentRoleId { get; set; }

        public virtual bool IsCheckLogin
        {
            get
            {
                return true;
            }
        }

        private static DLC520Socket _dlcsocket;

        private stock_manageEntities _dal;

        private const ushort _port = 8004;

        public ushort SocketPort
        {
            get
            {
                return _port;
            }
        }

        public DLC520Socket GetSocket(ushort port)
        {
            if (_dlcsocket == null)
                _dlcsocket = new DLC520Socket(port);

            return _dlcsocket;

        }

        public void CloseSocket()
        {
            if (_dlcsocket != null)
                _dlcsocket.Close();
        }

        public stock_manageEntities DAL
        {
            get
            {
                if (_dal == null)
                    _dal = new stock_manageEntities();

                return _dal;
            }
        }

       

    }
}
